namespace GameSchool.Migrations
{
    using System.Data.Entity.Migrations;
    
    public partial class Student : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("TeacherCourses", "teacher_teacherID", "Teachers");
            DropForeignKey("TeacherCourses", "course_courseID", "Courses");
            DropForeignKey("TeacherCourses", "courseID", "Courses");
            DropForeignKey("TeacherCourses", "teacherID", "Teachers");
            DropIndex("TeacherCourses", new[] { "teacher_teacherID" });
            DropIndex("TeacherCourses", new[] { "course_courseID" });
            DropIndex("TeacherCourses", new[] { "courseID" });
            DropIndex("TeacherCourses", new[] { "teacherID" });
            AddColumn("Teachers", "selected", c => c.Boolean(nullable: false));
            DropTable("TeacherCourses");
        }
        
        public override void Down()
        {
            CreateTable(
                "TeacherCourses",
                c => new
                    {
                        teacherID = c.Int(nullable: false),
                        courseID = c.Int(nullable: false),
                        teacher_teacherID = c.Int(),
                        course_courseID = c.Int(),
                    })
                .PrimaryKey(t => new { t.teacherID, t.courseID });
            
            DropColumn("Teachers", "selected");
            CreateIndex("TeacherCourses", "teacherID");
            CreateIndex("TeacherCourses", "courseID");
            CreateIndex("TeacherCourses", "course_courseID");
            CreateIndex("TeacherCourses", "teacher_teacherID");
            AddForeignKey("TeacherCourses", "teacherID", "Teachers", "teacherID", cascadeDelete: true);
            AddForeignKey("TeacherCourses", "courseID", "Courses", "courseID", cascadeDelete: true);
            AddForeignKey("TeacherCourses", "course_courseID", "Courses", "courseID");
            AddForeignKey("TeacherCourses", "teacher_teacherID", "Teachers", "teacherID");
        }
    }
}
